<template>
  <div class="operation-bar">
    <el-button @click="handleGoBack" :disabled="isDisabled">
      <el-icon class="mr-1"><ArrowLeftBold/></el-icon>
      返回上级
    </el-button>
    <!-- 新增：当页面非回收站时显示上传按钮 -->
    <el-button 
      v-if="!isRecycle"
      type="primary" 
      @click="handleUpload"
    >
      <el-icon class="mr-1"><Upload/></el-icon>
      上传文件
    </el-button>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'
import { ArrowLeftBold, Upload } from '@element-plus/icons-vue'

const props = defineProps({
  isDisabled: {
    type: Boolean,
    default: false
  },
  // 新增：控制是否为回收站页面的标识
  isRecycle: {
    type: Boolean,
    default: false
  }
})

const emits = defineEmits(['go-back', 'upload'])

const handleGoBack = () => emits('go-back')
const handleUpload = () => emits('upload')
</script>

<style scoped>
.operation-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
</style>